/*package com.cn.hnust.utils;

import java.io.IOException;
import java.io.OutputStream;
import java.util.List;

import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletResponse;

import org.apache.commons.beanutils.PropertyUtils;
import org.apache.poi.hssf.usermodel.HSSFCell;
import org.apache.poi.hssf.usermodel.HSSFRow;
import org.apache.poi.hssf.usermodel.HSSFSheet;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;

public class ExportExcelUtil {
	
	*//**
	 * 1.此方法适用于第一行：统计期间（开始日期，结束日期），第二开始为内容，最后行为合计list的数据
	 * 2.如有其它导出格式拷贝此方法重新写
	* @Title: export 
	* @Description: TODO
	* @author hc_Nash.Ning
	* @param response
	* @param list 要导出的数据
	* @param sheetname excel导出的sheet名称
	* @param columnname 格式如下：
	* 1.按照（结算日期-wofinancedate-0,单号-eoserialorderid-0）配置
	* 解析样列：结算日期-wofinancedate-0【标题-pojo字段-0：不合计，1：合计列】
	* @param filename excel文件名称
	* @param startdate 开始日期
	* @param enddate 结束日期
	* @throws IOException
	* @throws
	 *//*
	public void export(HttpServletResponse response, List<?> list,
			String sheetname,String columnname,String filename,String startdate, String enddate) throws IOException {
		response.setContentType("APPLICATION/vnd.ms-excel");
		filename = new String(filename.getBytes("gb2312"), "ISO8859-1");
		response.setHeader("Content-Disposition","attachment;filename="+filename+".xls");
		ServletOutputStream outputStream = response.getOutputStream();
		OutputStream os = response.getOutputStream();
		String[] columnnamearr = columnname.split(",");
		HSSFWorkbook wb = new HSSFWorkbook();
		HSSFSheet ws = wb.createSheet(sheetname);
		int index = 0;

		index++;
		writeperiod(ws, index, startdate, enddate);
		index++;
		writetitle(ws, index,columnnamearr);
		
		for(Object obj:list){
			index++;
			writeContent(ws,index,columnnamearr,obj);
		}
		index++;
		writetotal(ws,index,"合计",columnnamearr,list);
		wb.write(os);
		os.flush();
		outputStream.flush();
		outputStream.close();
	}
	
	*//**
	 * 统计期间
	* @Title: writeperiod 
	* @Description: TODO
	* @author hc_Nash.Ning
	* @param ws
	* @param index
	* @param startdate
	* @param enddate
	* @throws
	 *//*
	public void writeperiod(HSSFSheet ws, int index, String startdate,
			String enddate) {
		HSSFRow row = ws.createRow(index);
		HSSFCell cell1 = row.createCell(1);
		cell1.setCellType(HSSFCell.CELL_TYPE_STRING);
		cell1.setCellValue("统计期间：");

		HSSFCell cell2 = row.createCell(2);
		cell2.setCellType(HSSFCell.CELL_TYPE_STRING);
		cell2.setCellValue(startdate);

		HSSFCell cell3 = row.createCell(3);
		cell3.setCellType(HSSFCell.CELL_TYPE_STRING);
		cell3.setCellValue(enddate);
	}
	
	*//**
	 * 写入excel标题
	* @Title: writetitle 
	* @Description: TODO
	* @author hc_Nash.Ning
	* @param ws
	* @param index
	* @param columnnamearr
	* @throws
	 *//*
	public void writetitle(HSSFSheet ws, int index,String[] columnnamearr) {
		HSSFRow row = ws.createRow(index);
		for(int i=0;i<columnnamearr.length;i++){
			String columntitlename = columnnamearr[i];
			String titlename = columntitlename.split("-")[0];
			HSSFCell cell1 = row.createCell(i+1);
			cell1.setCellType(HSSFCell.CELL_TYPE_STRING);
			cell1.setCellValue(titlename);
		}
	}
	
	*//**
	 * 写入excel内容
	* @Title: writeContent 
	* @Description: TODO
	* @author hc_Nash.Ning
	* @param ws
	* @param index
	* @param columnnamearr
	* @param bean
	* @throws
	 *//*
	public void writeContent(HSSFSheet ws, int index,String[] columnnamearr,Object bean){
		try {
			HSSFRow row = ws.createRow(index);
			for(int i=0;i<columnnamearr.length;i++){
				String columncontentname = columnnamearr[i];
				String columnenname = columncontentname.split("-")[1];
				HSSFCell cell1 = row.createCell(i+1);
				cell1.setCellType(HSSFCell.CELL_TYPE_STRING);
				Object objvalue = PropertyUtils.getProperty(bean, columnenname);
				String value = "";
				if(objvalue == null){
					value = "";
				}else{
					value = objvalue.toString();
				}
				cell1.setCellValue(value);
			}
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} 
	}

	*//**
	 * 合计部分
	* @Title: writetotal 
	* @Description: TODO
	* @author hc_Nash.Ning
	* @param ws
	* @param index
	* @param title
	* @param columnnamearr
	* @param list
	* @throws
	 *//*
	public void writetotal(HSSFSheet ws, int index, String title,String[] columnnamearr,List<?> list) {
		try {
			HSSFRow row = ws.createRow(index);
			
			for(int i=0;i<columnnamearr.length;i++){
				int isendflg=0;
				String columntotalname = columnnamearr[i];
				String columnenname = columntotalname.split("-")[1];
				String istotalcolumn = columntotalname.split("-")[2];
				if(!istotalcolumn.equals("1")){
					continue;
				}
				Float totalamount = 0f;
				for(Object obj:list){
					isendflg ++;
					Object objvalue = PropertyUtils.getProperty(obj, columnenname);
					Float value = 0f;
					if(objvalue != null && !objvalue.toString().equals("")){
						value = Float.valueOf(objvalue.toString());
					}
					totalamount += value;
					if(isendflg == list.size()){
						HSSFCell cell1 = row.createCell(i+1);
						cell1.setCellType(HSSFCell.CELL_TYPE_STRING);
						cell1.setCellValue(Util.convertToFloat(Util.priceFormart1(totalamount)));
					}
				}
			}
			HSSFCell cell1 = row.createCell(1);
			cell1.setCellType(HSSFCell.CELL_TYPE_STRING);
			cell1.setCellValue(title+" 记录数"+list.size()+"条");
			
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}
}
*/